	//document.getElementById的缩写
	function getbyid($a){
		return document.getElementById($a);
	}
	
	function setbyidhtml($id,$name,$str){
		getbyid($id).innerHTML=getbyid($id).innerHTML.replace('{' + $name + '}',$str);
	}
	function setbyidhtmlrow($id,$row){
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
		Object.keys($row).forEach(function($a){
			setbyidhtml($id,$a,$row[$a])
		})
	}

	function setbyidhtmlrows($id,$row){
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
		var $tmp =getbyid($id).innerHTML;
		var tmp2=$tmp;
		var html='';
		for (var $i = 0; $i < $row.length ; $i++) {
			Object.keys($row[$i]).forEach(function($a,$tmp){
				tmp2=tmp2.replace('{' + $a + '}',$row[$i][$a]);
			});
			html+=tmp2;
			tmp2=$tmp;
		}
		//console.log(html);
		getbyid($id).innerHTML=html;		
	}
	//get
	function httpget(URL,PARAMS){
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
		// 初始化XMLHttpRequest对象
		var xmlrequest = new XMLHttpRequest();
		var text='';
		for (var x in PARAMS) {
			text+=x + '=' + PARAMS[x]+'&';
		}
		// 设置以POST方式发送请求，false是同步,true为异步
		xmlrequest.open("GET", URL+'?'+text.substring(text,text.length-1), false); 
		// 设置POST请求的请求头
		xmlrequest.setRequestHeader("Content-Type"
			, "application/x-www-form-urlencoded");
		xmlrequest.send('a=1&b=1');
		//异步消息处理
		/*xmlrequest.onreadystatechange = function(){
	        if (this.readyState == 4)
        {
            if(this.status == 200)
            {
            	return this.responseText;

            }
        }

		};*/
		return xmlrequest.responseText;
	}
	//post
	function httppost(URL,PARAMS){
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
		// 初始化XMLHttpRequest对象
		var xmlrequest = new XMLHttpRequest();
		var text='';
		
		for (var x in PARAMS) {
			text+=x + '=' + PARAMS[x]+'&';
		}
		
		// 设置以POST方式发送请求，false是同步,true为异步
		xmlrequest.open("POST", URL, false); 
		// 设置POST请求的请求头
		xmlrequest.setRequestHeader("Content-Type"
			, "application/x-www-form-urlencoded");
		xmlrequest.send(text.substring(text,text.length-1));
		//异步消息处理
		/*xmlrequest.onreadystatechange = function(){
	        if (this.readyState == 4)
        {
            if(this.status == 200)
            {
            	return this.responseText;

            }
        }

		};*/
		return xmlrequest.responseText;
	}
	//模拟表单提交post
	function formpost(URL, PARAMS) {
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
	  var temp = document.createElement("form");
	  temp.action = URL;
	  temp.method = "POST";
	  temp.style.display = "none";
	  for (var x in PARAMS) {
	    var opt = document.createElement("textarea");
	    opt.name = x;
	    opt.value = PARAMS[x];
	    temp.appendChild(opt);
	  }
	  document.body.appendChild(temp);
	  temp.submit();
	  return temp;
	}
	//模拟表单提交GET
	function formget(URL, PARAMS) {
		if(typeof($row)=='string'){
			$row=eval('(' + $row + ')');
		}
	  var temp = document.createElement("form");
	  temp.action = URL;
	  temp.method = "GET";
	  temp.style.display = "none";
	  for (var x in PARAMS) {
	    var opt = document.createElement("textarea");
	    opt.name = x;
	    opt.value = PARAMS[x];
	    // alert(opt.name)
	    temp.appendChild(opt);
	  }
	  document.body.appendChild(temp);
	  temp.submit();
	  return temp;
	}
